<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><!-- saved from url=(0031)http://pubpages.unh.edu/~jmb97/ -->


<title>Misc - SPriG</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta content="MSHTML 6.00.2900.3157" name="GENERATOR"></head>
<body>
<tc></tc>
<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="text-align: center; height: 33px; background-color: rgb(51, 51, 255); width: 1076px;" colspan="2"><big style="font-weight: bold; color: white;"><big>Miscellaneous Functions</big></big></td>
</tr>
<tr>
<td style="vertical-align: top; background-color: rgb(91, 128, 255); width: 105px;">
<a style="font-weight: bold; color: white;" href="Primitives.html">Primitives</a><br style="font-weight: bold; color: white;">
<a style="font-weight: bold; color: white;" href="Polygon.html">Polygon</a><br style="font-weight: bold; color: white;">
<a style="font-weight: bold; color: white;" href="Transform.html">Transform</a><br style="font-weight: bold; color: white;">
<a style="font-weight: bold; color: white;" href="Surface.html">Surface</a><br style="font-weight: bold; color: white;">
<a style="font-weight: bold; color: white;" href="Drawing.html">Drawing</a><br><a style="font-weight: bold; color: white;" href="Dirty%20Rects.html">Dirty Rect</a><br style="font-weight: bold; color: white;">
<a style="font-weight: bold; color: white;" href="Palette.html">Palette</a><br style="font-weight: bold; color: white;">
<a style="font-weight: bold; color: white;" href="Control.html">Control</a><a style="font-weight: bold; color: white;" href="States.html"></a><br style="font-weight: bold; color: white;">
<span style="font-weight: bold; color: black;">Misc</span><br style="font-weight: bold; color: white;">
<a style="font-weight: bold; color: white;" href="Defines.html">Defines</a><br><a style="color: white; font-weight: bold;" href="Types.html">Types</a><br style="font-weight: bold; color: white;">
<a style="font-weight: bold; color: white;" href="Extended.html">Extended</a><br style="font-weight: bold; color: white;">
<br style="font-weight: bold; color: white;">
<a style="font-weight: bold; color: white;" href="Arguments.html">Arguments</a><br style="font-weight: bold; color: white;">
<br style="font-weight: bold; color: white;">
<a style="font-weight: bold; color: white;" href="index.html">Index</a><br style="font-weight: bold; color: white;">
<a style="font-weight: bold; color: white;" href="Credits.html">Credits</a><br>
</td>
<td style="vertical-align: top; height: 600px; width: 1076px;"><br>
<table style="text-align: left; width: 762px; margin-left: 30px;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 81px;">Return</td>
<td style="width: 175px;">Name</td>
<td style="width: 478px;">Arguments</td>
</tr>
<tr><td><span style="color: rgb(0, 0, 153);"><span style="font-weight: bold;">SDL_Surface</span></span><span style="color: rgb(0, 0, 153);">*</span></td><td style="font-weight: bold;">SPG_InitSDL</td><td><span style="color: rgb(226, 94, 98);">Uint16</span>&nbsp;w,&nbsp;<span style="color: rgb(226, 94, 98);">Uint16</span> h,&nbsp;<span style="color: rgb(0, 102, 0);">Uint8</span> bitsperpixel,&nbsp;<span style="color: rgb(153, 51, 153);">Uint32</span> systemFlags,&nbsp;<span style="color: rgb(153, 51, 153);">Uint32</span> screenFlags</td></tr><tr><td><span style="color: rgb(0, 102, 0);">Uint8</span></td><td><span style="font-weight: bold;">SPG_GetRed</span></td><td><span style="color: rgb(0, 0, 153);"><span style="font-weight: bold;">SDL_Surface</span></span><span style="color: rgb(0, 0, 153);">*</span>&nbsp;surface,&nbsp;<span style="color: rgb(153, 51, 153);">Uint32</span> color</td></tr><tr><td><span style="color: rgb(0, 102, 0);">Uint8</span></td><td><span style="font-weight: bold;">SPG_GetGreen</span></td><td><span style="color: rgb(0, 0, 153);"><span style="font-weight: bold;">SDL_Surface</span></span><span style="color: rgb(0, 0, 153);">*</span>&nbsp;surface,&nbsp;<span style="color: rgb(153, 51, 153);">Uint32</span> color</td></tr><tr><td><span style="color: rgb(0, 102, 0);">Uint8</span></td><td><span style="font-weight: bold;">SPG_GetBlue</span></td><td><span style="color: rgb(0, 0, 153);"><span style="font-weight: bold;">SDL_Surface</span></span><span style="color: rgb(0, 0, 153);">*</span>&nbsp;surface,&nbsp;<span style="color: rgb(153, 51, 153);">Uint32</span> color</td></tr><tr><td><span style="color: rgb(0, 102, 0);">Uint8</span></td><td><span style="font-weight: bold;">SPG_GetAlpha</span></td><td><span style="color: rgb(0, 0, 153);"><span style="font-weight: bold;">SDL_Surface</span></span><span style="color: rgb(0, 0, 153);">*</span>&nbsp;surface,&nbsp;<span style="color: rgb(153, 51, 153);">Uint32</span> color</td></tr><tr><td><span style="color: rgb(153, 51, 153);">Uint32</span></td><td style="font-weight: bold;">SPG_MixRed</td><td><span style="color: rgb(0, 0, 153);"><span style="font-weight: bold;">SDL_Surface</span></span><span style="color: rgb(0, 0, 153);">*</span>&nbsp;surface,&nbsp;<span style="color: rgb(153, 51, 153);">Uint32</span> color,&nbsp;<span style="color: rgb(0, 102, 0);">Uint8</span> red</td></tr><tr><td><span style="color: rgb(153, 51, 153);">Uint32</span></td><td style="font-weight: bold;">SPG_MixGreen</td><td><span style="color: rgb(0, 0, 153);"><span style="font-weight: bold;">SDL_Surface</span></span><span style="color: rgb(0, 0, 153);">*</span>&nbsp;surface,&nbsp;<span style="color: rgb(153, 51, 153);">Uint32</span> color,&nbsp;<span style="color: rgb(0, 102, 0);">Uint8</span> green</td></tr><tr><td><span style="color: rgb(153, 51, 153);">Uint32</span></td><td style="font-weight: bold;">SPG_MixBlue</td><td><span style="color: rgb(0, 0, 153);"><span style="font-weight: bold;">SDL_Surface</span></span><span style="color: rgb(0, 0, 153);">*</span>&nbsp;surface,&nbsp;<span style="color: rgb(153, 51, 153);">Uint32</span> color,&nbsp;<span style="color: rgb(0, 102, 0);">Uint8</span> blue</td></tr><tr><td><span style="color: rgb(153, 51, 153);">Uint32</span></td><td style="font-weight: bold;">SPG_MixAlpha</td><td><span style="color: rgb(0, 0, 153);"><span style="font-weight: bold;">SDL_Surface</span></span><span style="color: rgb(0, 0, 153);">*</span>&nbsp;surface,&nbsp;<span style="color: rgb(153, 51, 153);">Uint32</span> color,&nbsp;<span style="color: rgb(0, 102, 0);">Uint8</span> alpha</td></tr><tr><td><span style="color: rgb(153, 51, 153);">Uint32</span></td><td><span style="font-weight: bold;">SPG_ConvertColor</span></td><td><span style="font-weight: bold; color: rgb(153, 102, 51);">SDL_PixelFormat</span><span style="color: rgb(153, 102, 51);">*</span>&nbsp;srcfmt,&nbsp;<span style="color: rgb(153, 51, 153);">Uint32</span> srccolor,&nbsp;<span style="font-weight: bold; color: rgb(153, 102, 51);">SDL_PixelFormat</span><span style="color: rgb(153, 102, 51);">*</span> destfmt</td></tr><tr><td><span style="color: rgb(51, 102, 255);">int</span></td><td style="font-weight: bold;">SPG_Clamp</td><td><span style="color: rgb(51, 102, 255);">int</span>&nbsp;value,&nbsp;<span style="color: rgb(51, 102, 255);">int</span> min,&nbsp;<span style="color: rgb(51, 102, 255);">int</span> max</td></tr><tr><td><span style="color: red; font-weight: bold;">SDL_Rect</span></td><td style="font-weight: bold;">SPG_MakeRect</td><td><span style="color: rgb(30, 209, 53);">Sint16 </span>x,&nbsp;<span style="color: rgb(30, 209, 53);">Sint16 </span>y,&nbsp;<span style="color: rgb(226, 94, 98);">Uint16 </span>w,&nbsp;<span style="color: rgb(226, 94, 98);">Uint16 </span>h</td></tr><tr><td><span style="color: red; font-weight: bold;">SDL_Rect</span></td><td style="font-weight: bold;">SPG_MakeRectRelative</td><td><span style="color: rgb(30, 209, 53);">Sint16 </span>x,&nbsp;<span style="color: rgb(30, 209, 53);">Sint16 </span>y,&nbsp;<span style="color: rgb(30, 209, 53);">Sint16 </span>x2,&nbsp;<span style="color: rgb(30, 209, 53);">Sint16 </span>y2</td></tr><tr><td style="font-weight: bold;"><span style="color: rgb(102, 0, 0);">SPG_Point</span></td><td style="font-weight: bold;">SPG_MakePoint</td><td><span style="color: rgb(30, 209, 53);">Sint16</span>&nbsp;x,&nbsp;<span style="color: rgb(30, 209, 53);">Sint16</span> y</td></tr><tr><td><span style="color: rgb(94, 113, 150);">SPG_bool</span></td><td style="font-weight: bold;">SPG_RectAND</td><td><span style="color: red;">const&nbsp;</span><span style="font-weight: bold; color: red;">SDL_Rect</span><span style="color: red;"></span> A, <span style="color: red;">const <span style="font-weight: bold;">SDL_Rect</span></span> B, <span style="font-weight: bold; color: red;">SDL_Rect</span><span style="color: red;">*</span> intersection</td></tr><tr><td>void</td><td style="font-weight: bold;">SPG_RectOR</td><td><span style="color: red;">const <span style="font-weight: bold;">SDL_Rect</span></span> rect1, <span style="color: red;">const <span style="font-weight: bold;">SDL_Rect</span></span> rect2, <span style="color: red;"><span style="font-weight: bold;">SDL_Rect</span>*</span> dst_rect</td></tr>






</tbody>
</table>
<br>
<br>SDL_Surface* SPG_InitSDL(Uint16 w, Uint16 h, Uint8 bitsperpixel, Uint32 systemFlags, Uint32 screenFlags)<br>-
Returns the display surface after calling SDL_Init() and
SDL_SetVideoMode(). &nbsp;If the surface is NULL, there has been an
error.<br><br>Uint8 SPG_GetRed(SDL_PixelFormat* format, Uint32 color)<br>- Returns the red color component.<br><br>Uint8 SPG_GetGreen(SDL_PixelFormat* format, Uint32 color)<br>- Returns the green color component.<br><br>Uint8 SPG_GetBlue(SDL_PixelFormat* format, Uint32 color)<br>- Returns the blue color component.<br><br>Uint8 SPG_GetAlpha(SDL_PixelFormat* format, Uint32 color)<br>- Returns the alpha color component.<br><br>Uint32 SPG_MixRed(SDL_PixelFormat* format, Uint32 color, Uint8 red)<br>- Returns a color value with the red component overwritten by the given red.<br><br>Uint32 SPG_MixGreen(SDL_PixelFormat* format, Uint32 color, Uint8 green)<br>- Returns a color value with the green component overwritten by the given green.<br><br>Uint32 SPG_MixBlue(SDL_PixelFormat* format, Uint32 color, Uint8 blue)<br>- Returns a color value with the blue component overwritten by the given blue.<br><br>Uint32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SPG_MixAlpha(SDL_Surface *surface, Uint32 color, Uint8 alpha)<br>- Returns a color value with the alpha component overwritten by the given alpha.<br><br>Uint32 SPG_ConvertColor(SDL_PixelFormat* srcfmt, Uint32 srccolor, SDL_PixelFormat* destfmt)<br>- Takes a color in the source format, then returns it in the dest format.<br><br>int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SPG_Clamp(int value, int min, int max)<br>- Returns the given value forced to be between min and max.<br><br>float&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SPG_sqrt(float x)<br>-
Returns the approximate square root of the given value.&nbsp; This
function performs much faster than the standard sqrt found in math.h,
while giving reasonable precision for heavy real-time usage.<br><br>SDL_Rect&nbsp;&nbsp;&nbsp; SPG_MakeRect(Sint16 x, Sint16 y, Uint16 w, Uint16 h)<br>- Returns an SDL_Rect initialized with the given values.<br><br>SDL_Rect&nbsp;&nbsp;&nbsp; SPG_MakeRectRelative(Sint16 x, Sint16 y, Sint16 x2, Sint16 y2)<br>- Returns an SDL_Rect defined by the two given points.<br><br>SPG_Point&nbsp;&nbsp; SPG_MakePoint(Sint16 x, Sint16 y)<br>- Returns an SPG_Point object from the given coordinates.<br><br>SPG_bool&nbsp;&nbsp;&nbsp; SPG_RectAND(const SDL_Rect&amp; A, const SDL_Rect&amp; B, SDL_Rect* intersection)<br>-
Returns true if the given rects intersect.&nbsp; In that case, the
intersection rect is set to the intersection of the other two.<br><br>void&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
SPG_RectOR(const SDL_Rect&amp; rect1, const SDL_Rect&amp; rect2,
SDL_Rect&amp; dst_rect)<br>- Takes three rects and fills out the third to be a rect that contains both of the others.<br>
<br>
</td>
</tr>
</tbody>
</table>
<br>
SPriG v1.0.0 Documentation by Jonathan Dearborn 2008
</body></html>